package com.sens.ipc.mybank.hooker;

import android.content.Context;
import android.content.Intent;

import com.sens.ipc.common.CommonAction;
import com.sens.ipc.mybank.Action;

public abstract class Handle implements Callback {
    private Context context;

    protected Handle(Context context) {
        this.context = context;
    }

    @Override
    public void checkUserId() {
        context.sendBroadcast(new Intent(Action.Hooker.ACTION_CHECK_USERID));
    }

    @Override
    public void queryOrder() {
        context.sendBroadcast(new Intent(Action.Hooker.ACTION_QUERY_ORDER));
    }

    @Override
    public void setChannelNumber(String channelNumber) {
        Intent intent = new Intent(Action.Hooker.ACTION_SET_CHANNEL_NUMBER);
        intent.putExtra(Action.Hooker.ACTION_SET_CHANNEL_NUMBER, channelNumber);
        context.sendBroadcast(intent);
    }

    @Override
    public void setQueryTimeInterval(String queryTimeInterval) {
        Intent intent = new Intent(Action.Hooker.ACTION_SET_QUERY_TIME_INTERVAL);
        intent.putExtra(Action.Hooker.ACTION_SET_QUERY_TIME_INTERVAL, queryTimeInterval);
        context.sendBroadcast(intent);
    }

    @Override
    public void start() {
        context.sendBroadcast(new Intent(Action.Hooker.ACTION_START));
    }

    @Override
    public void stop() {
        context.sendBroadcast(new Intent(Action.Hooker.ACTION_STOP));
    }

    @Override
    public void setHost(String host) {
        Intent intent = new Intent(CommonAction.Hooker.ACTION_SET_HOST);
        intent.putExtra(CommonAction.Hooker.ACTION_SET_HOST, host);
        context.sendBroadcast(intent);
    }

    public abstract void unBind();
}